package org.zfes.snowier.cloud.zbss.cms.router.service.words;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.words.model.CmsWordsSearch;
import org.zfes.snowier.cloud.zbss.cms.words.service.ICmsWordsSearchService;
@Controller 
@RequestMapping("/cms/words/cmsWordsSearch")
public class CmsWordsSearchController extends BaseController {

	
	@Autowired
	private ICmsWordsSearchService cmsWordsSearchService;
	
	@RequiresPermissions(value="cmsWordsSearch:loadCmsWordsSearchDataSet",desc="搜索记录列表")
    @RequestMapping(value="/loadCmsWordsSearchDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsSearchDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsWordsSearchService.loadCmsWordsSearchDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsWordsSearch:createCmsWordsSearch",desc="搜索记录添加")
    @RequestMapping(value="/createCmsWordsSearch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsWordsSearch(CmsWordsSearch cmsWordsSearch){
		cmsWordsSearchService.createCmsWordsSearch(cmsWordsSearch);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsSearch:loadCmsWordsSearch",desc="搜索记录加载")
    @RequestMapping(value="/loadCmsWordsSearch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsSearch(Long id){
		Optional<CmsWordsSearch> ops = cmsWordsSearchService.loadCmsWordsSearchById(id);
		return ajaxQuery("cmsWordsSearch",ops);
    }
	
	@RequiresPermissions(value="cmsWordsSearch:updateCmsWordsSearch",desc="搜索记录更新")
    @RequestMapping(value="/updateCmsWordsSearch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsWordsSearch(CmsWordsSearch cmsWordsSearch){
		cmsWordsSearchService.updateCmsWordsSearch(cmsWordsSearch);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsSearch:deletCmsWordsSearch",desc="搜索记录删除")
    @RequestMapping(value="/deleteCmsWordsSearch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsWordsSearch(Long id){
		cmsWordsSearchService.deleteCmsWordsSearch(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}